package com.cj.allTest;

import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author chan
 * @dateTime 2023/4/20  13:41:15
 */

public class TestSimple {

    @Test
    public void method() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(format.format(new Date(1681980805545L)));
        System.out.println(format.format(new Date(1682784000000L)));

    }

    @Test
    public void method1() throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(simpleDateFormat.format(new Date(1684944000000L)));
        System.out.println(simpleDateFormat.parse("2023-05-22").getTime());
        System.out.println(simpleDateFormat.parse("2023-06-11").getTime());
    }

    @Test
    public void method2() throws InterruptedException {
        Long date = new Date().getTime();
        Thread.sleep(10000L);
        Long date1 = new Date().getTime();
        System.out.println((date1 - date) / 1000);
    }
}
